<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>二维码身份证</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<script src="js/rem_750.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>

		<div class="bg">
			<div class="identity">
				<div class="input_name">
					<span class="name"></span><span>:</span>
				</div>
				<!-- 文字 -->
				<div class="p_txt">
					<!-- <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;欢迎您在<span>9月28日10:00</span>参观2019广州国际花卉艺术展暨中国插花花艺展。</p> -->
				</div>
				<!-- 图片上传 -->
				<div class="photo"></div>
				<!-- 保存图片 -->
				<div class="save_btn">
					<a class="btn_save" download="pic" style="display: block;">保存图片</a>
				</div>
				<div class="p_txt2">
					<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请保存此页面，进入参观区域前向工作人员出示，谢谢！</p>
				</div>
			</div>
		</div>
		<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/util.js" charset="utf-8"></script>
		<script src="js/api.js" charset="utf-8"></script>
		<script type="text/javascript">
			var temp_url =
				"http://127.0.0.1:8848/20200226jq/result.html?show_id=1&day_time=2019-10-04&uname=aaa&access_token=7e0e579dd01711c589a6a9KhkZe0ba0a286fc"
			$(function() {
				function handleStr(daytime) {
					console.log(daytime)
					var arr = daytime.split("-");
					// console.log(arr)
					// if(arr[1].indexOf("0") == "0"){
					// 	arr[1]=arr[1].substr(1);
					// }
					// 等价的
					arr[1] = arr[1].replace(/^0/, "");
					return arr[1] + "月" + arr[2] + "日";
				}
				var show_list = ["-","09:00","12:00","14:30"];
				var show_id = getQueryString("show_id");
				var day_time = getQueryString("day_time");
				var uname = getQueryString("uname");
				var access_token = getQueryString("access_token");
				// $("input_name").find(".name").text(uname)
				var str = " 欢迎您在" + handleStr(day_time) + show_list[show_id] + "参观2019广州国际花卉艺术展暨中国插花花艺展。"
				$(".p_txt").text(str)
				console.log(uname, day_time, show_id, access_token)
				$(".name").text(uname);
				$.ajax({
					method: "get",
					url: api.code,
					timeout: 3000,
					data: {
						show_id: show_id,
						day_time: day_time,
						uname: uname,
						access_token: access_token
					},
					success: function(res) {
						var p_txt = $(".p_txt").find("span").text(day_time)
						console.log(res);
						var imgUrl = res.data.data;
						$(".btn_save").attr("href", imgUrl)
						$(".photo").append(`<img style="width:100%;height:100%;" src=${imgUrl} />`)
					}

				})


			})
		</script>
	</body>
</html>
